package com.rico.gateway.config;

import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description 添加标签，方便后续监控分组使用
 * @Author Huang Wenxue
 * @Date 2020/6/24 10:20
 * @Version 1.0
 */
@Configuration
public class PrometheusCustomizerConfig {
    @Bean
    public MeterRegistryCustomizer<MeterRegistry> meterRegistryCustomizer(@Value("${spring.application.name}") String applicationName) {
        return registry -> registry.config().commonTags("application", applicationName).commonTags("group", "lookdoor-property");
    }
}
